import time
def sleep(n):
    print('start sleep')
    yield time.time()+n#切出去
    print('end sleep')
def func():
    print(123)
    g=sleep(1)
    yield from g
    print(456)

g=func()
ret=next(g)
print(ret)
time.sleep(ret-time.time())
next(g)

















